pp108 : onchange Event (Dropdown, Listbox)

onchange Event (Dropdown, Listbox)

 


This event is fired when the contents of the object selected have changed.

Syntax

Inline HTML

<div cordysType="wcp.library.ui.Dropdown"  id=dropdownID onchange="handler()"...>
...
</div>

OR

<div cordysType="wcp.library.ui.ListBox" id=dropdownID onchange="handler()"...>
...
</div>

Event property

controlID.onchange = handler

 

Event Information

To invoke

Change the item displayed in the dropdown or listbox.

Default Action

Initiates any action associated with this event.

 

Event Object Properties


Although event handlers in the DHTML Object model do not receive parameters directly, a handler can query an event object for data.

 Event Object Properties for Dropdown 

option

Read-only. Object that denotes the item that is currently selected in the dropdown.

selectedIndex

Read-only. Integer that denotes the index of the selected item.

text

Read-only. String that contains the text displayed in the selected item.

value

Read-only. String that contains the value of the selected item.

Event Object Properties for Listbox

options

Read-only. Read Only Array of Object that denotes the items that are currently selected in the listbox.

selectedIndex

Read-only. Integer that denotes the index of the selected item. In multiple select type, it is the index of the last selected item. (soon to be deprecated)

text

Read-only. String that contains the text displayed in the selected item. In multiple select type, the string that contains the text displayed in the last selected item. (soon to be deprecated)

value

Read-only. String that contains the value of the selected item. In multiple select type, the string that contains the value of the last selected item from the array of selected items. (soon to be deprecated)

See Also


Dropdown, Listbox